//
//  HttpClient.h
//  MaiJianBaseProject
//
//  Created by Michael Fan on 14-7-9.
//  Copyright (c) 2014年 Michael Fan. All rights reserved.
//
/*
 http通讯--
 get--post--mulpost(developing)--download(developing)
 设置http-header
 设置请求超时时间
 设置接收数据格式-json/xml
 统一的请求失败错误处理。
 */

/*
 服务器返回数据的key-服务器返回数据的二种情况-列表-单个数据-数据组织方式可能不同key不同-也可能相同
 */

#import "QiniuSDK.h"

#define requestDataKey    @"results"


#import "AFHTTPRequestOperationManager.h"
#import "UIKit+AFNetworking.h"

//#define request_OSAPPV @"os=ios&appv=15"
#define kErrorInt   -1

#define kHttpRequestTimeOutInterval  10

#define apiHeader @"/api2"
#define apiValue @"api=7"


#define serverUrl  @"http://api.mingyizhudao.com"

enum
{
    STATE_SUCCESS = 0,
};

@interface HttpClient : AFHTTPRequestOperationManager


- (AFHTTPRequestOperation *)GET:(NSString *)URLString
                     parameters:(id)parameters
                        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                        failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;

- (AFHTTPRequestOperation *)POSTOTHER:(NSString *)URLString
                      parameters:(id)parameters
                         success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                         failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;

- (void)POST:(NSString *)URLString
         parameters:(id)parameters
            success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
            failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;

//上传图片
- (AFHTTPRequestOperation *)UPLOADIMAGE:(NSString *)URLString
                            uploadImage:(UIImage *)image
                             parameters:(id)parameters
                                success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                                failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;


- (void)UPLOADIMAGEQINIU:(NSString *)URLString
             uploadImage:(UIImage *)image
         uploadImageName:(NSString *)imageName
              parameters:(id)parameters
                 success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                 failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;


@end

















